from nativePlugins.NativePlugin import LoadEvent

PLUGINS = []

def createLoadEvent(by, url):
    return LoadEvent(by, url)

def addPlugin(plugin):
    if plugin is not None:
        PLUGINS.append(plugin)

from nativePlugins.fuckAdvertising.fuckAdvertising import *
def init():
    addPlugin(fuckAdvertising_INSTANCE)

def triggerLoadedEvent(event):
    try:
        print("triggerLoadedEvent -> " + str(event))
        for plugin in PLUGINS:
            plugin.loadEvent(event)
    except Exception as e:
        print(e)

def triggerLoadStartEvent(event):
    try:
        print("triggerLoadStartEvent -> " + str(event))
        for plugin in PLUGINS:
            plugin.loadStartEvent(event)
    except Exception as e:
        print(e)

def triggerLoadProgressEvent(event, progress):
    try:
        print("triggerLoadProgressEvent -> " + str(progress))
        for plugin in PLUGINS:
            plugin.loadProgress(event, progress)
    except Exception as e:
        print(e)